/*
 * Copyright (c) 2010 Google Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.google.api.data.contacts.v3;

/**
 * URL for contacts API.<br>
 * It contains a list of all the URL parameters for the feed.
 * 
 * @author Nicolas Garnier
 */
public class UrlFactory {

  // ================== Attributes ====================

  /** Root URL. */
  public static final String ROOT_URL = "https://www.google.com/m8/feeds/";

  /** To access default account feeds and entries. */
  public static final String DEFAUL_ACCOUNT = "default";

  // =================== Constructor =================

  /**
   * Private constructor for utility class.
   */
  private UrlFactory() {
  }

  // ====================== Feeds URL ===================

  /**
   * Returns the shared contacts URL for the given domain.
   * 
   * @param domain The name of the domain of which to access the Shared Contacts
   *          in the form "domain.com"
   * @return The URL to the Shared Contacts Feed
   */
  public static ContactsUrl getSharedContactsFeedUrl(String domain) {
    return new ContactsUrl(ROOT_URL + "contacts/" + domain + "/full");
  }

  /**
   * Returns the shared contacts batch feed URL for the given domain.
   * 
   * @param domain The name of the domain of which to access the Shared Contacts
   *          batch feed in the form "domain.com"
   * @return The URL to the Shared Contacts Feed
   */
  public static ContactsUrl getSharedContactsBatchFeedUrl(String domain) {
    return new ContactsUrl(ROOT_URL + "contacts/" + domain + "/full/batch");
  }

  /**
   * Returns the Domain User Profiles URL for the given domain.
   * 
   * @param domain The name of the domain of which to access the Domain user
   *          Profiles in the form "domain.com"
   * @return The URL to the Domain user Profiles Feed
   */
  public static UserProfilesUrl getDomainUserProfilesFeedUrl(String domain) {
    return new UserProfilesUrl(ROOT_URL + "profiles/domain/" + domain + "/full");
  }

  /**
   * Returns the Domain User Profiles batch feed URL for the given domain.
   * 
   * @param domain The name of the domain of which to access the Domain user
   *          Profiles batch feed in the form "domain.com"
   * @return The URL to the Domain user Profiles Feed
   */
  public static UserProfilesUrl getDomainUserProfilesBatchFeedUrl(String domain) {
    return new UserProfilesUrl(ROOT_URL + "profiles/domain/" + domain + "/full/batch");
  }

  /**
   * Returns the contacts URL for the given account.
   * 
   * @param email The email of the account for which to access the contacts
   * @return the URL to the Contacts Feed of the given account
   */
  public static ContactsUrl getContactsFeedUrl(String email) {
    return new ContactsUrl(ROOT_URL + "contacts/" + email + "/full");
  }

  /**
   * Returns the contacts URL for the authenticated account.
   * 
   * @return The URL to the contacts feed of the currently authenticated account
   */
  public static ContactsUrl getDefaultContactsFeedUrl() {
    return new ContactsUrl(ROOT_URL + "contacts/" + DEFAUL_ACCOUNT + "/full");
  }

  /**
   * Returns the contacts batch feed URL for the given account.
   * 
   * @param email The email of the account for which to access the contacts
   *          batch feed
   * @return the URL to the contacts batch feed of the given account
   */
  public static ContactsUrl getContactsBatchFeedUrl(String email) {
    return new ContactsUrl(ROOT_URL + "contacts/" + email + "/full/batch");
  }

  /**
   * Returns the contacts batch feed URL for the authenticated account.
   * 
   * @return The URL to the contacts batch feed of the currently authenticated
   *         account
   */
  public static ContactsUrl getDefaultContactsBatchFeedUrl() {
    return new ContactsUrl(ROOT_URL + "contacts/" + DEFAUL_ACCOUNT + "/full/batch");
  }

  /**
   * Returns the contact groups URL for the given account.
   * 
   * @param email The email of the account for which to access the contact
   *          groups
   * @return the URL to the contact groups Feed of the given account
   */
  public static ContactsUrl getContactGroupsFeedUrl(String email) {
    return new ContactsUrl(ROOT_URL + "groups/" + email + "/full");
  }

  /**
   * Returns the contact groups URL for the authenticated account.
   * 
   * @return The URL to the contact groups feed of the currently authenticated
   *         account
   */
  public static ContactsUrl getDefaultContactGroupsFeedUrl() {
    return new ContactsUrl(ROOT_URL + "groups/" + DEFAUL_ACCOUNT + "/full");
  }

  /**
   * Returns the contact groups batch feed URL for the given account.
   * 
   * @param email The email of the account for which to access the contact
   *          groups
   * @return the URL to the contact groups batch feed of the given account
   */
  public static ContactsUrl getContactGroupsBatchFeedUrl(String email) {
    return new ContactsUrl(ROOT_URL + "groups/" + email + "/full/batch");
  }

  /**
   * Returns the contact groups batch feed URL for the authenticated account.
   * 
   * @return The URL to the contact groups batch feed of the currently
   *         authenticated account
   */
  public static ContactsUrl getDefaultContactGroupsBatchFeedUrl() {
    return new ContactsUrl(ROOT_URL + "groups/" + DEFAUL_ACCOUNT + "/full/batch");
  }
}
